
const systemEvent = cc.systemEvent


export function addListener(eventName: string, callback:(...args: any) => any, target: any = null) {
    systemEvent.on(eventName, callback, target);
}

export function dispatchEvent(eventName: string, userData: any = null) {
    let event = new cc.Event.EventCustom(eventName, false);
    event.setUserData(userData);
    systemEvent.dispatchEvent(event);
}
